package cn.jeefast.modules.platform.controller;


        import cn.jeefast.common.entity.MbResearch;
        import cn.jeefast.common.utils.R;
        import cn.jeefast.modules.platform.service.MbResearch1Service;
        import com.baomidou.mybatisplus.mapper.EntityWrapper;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.CrossOrigin;
        import org.springframework.web.bind.annotation.RequestMapping;

        import org.springframework.web.bind.annotation.RestController;
        import cn.jeefast.common.base.BaseController;

        import java.util.List;

/**
 * <p>
 * 研究组表 前端控制器
 * </p>
 *
 * @author theodo
 * @since 2020-01-06
 */
@RestController
@RequestMapping("/mbResearch")
@CrossOrigin
public class MbResearch1Controller extends BaseController {

    @Autowired
    private MbResearch1Service researchService;

    /**
     * 研究组列表（根据ID）
     * @param projId
     * @return
     */
    @RequestMapping("list")
    public R list(Long projId){
        EntityWrapper ew = new EntityWrapper();
        ew.eq("proj_id",projId);
        List list = researchService.selectList(ew);
        return R.ok().put("data",list);
    }

    /**
     * 添加或修改研究组
     * @param research
     * @return
     */
    @RequestMapping("/addOrSave")
    public R addOrSave(MbResearch research){
        return researchService.addOrSave(research);
    }

    /**
     * 删除
     * @param resId
     * @return
     */
    @RequestMapping("/delete")
    public R delete(Long resId){
        researchService.deleteById(resId);
        return R.ok();
    }
}
